package com.qimei.onerice.service.impl;

import com.qimei.onerice.dao.AdminDao;
import com.qimei.onerice.dao.impl.AdminDaoImpl;
import com.qimei.onerice.entity.Admin;
import com.qimei.onerice.service.AdminService;

import java.util.List;

public class AdminServiceImpl implements AdminService {
	AdminDao adminDao = new AdminDaoImpl();
	@Override
	public Admin adminLogin(String username, String password) {
		return adminDao.adminLogin(username, password);
	}

	@Override
	public List<Admin> getAdminList() {
		return adminDao.getAllAdmins();
	}

	@Override
	public boolean deleteAdmin(int adminId) {
		int result = adminDao.deleteAdmin(adminId);
		return result > 0;
	}

	@Override
	public boolean updateAdmin(Admin admin) {
		int result = adminDao.updateAdmin(admin);
		return result > 0;
	}

	@Override
	public boolean addAdmin(Admin admin) {
		int result = adminDao.addAdmin(admin);
		return result > 0;
	}

	@Override
	public boolean isAdminExists(String username, String contact, String email) {
		return false;
	}

	@Override
	public Admin getAdminById(int adminId) {
		return adminDao.getAdminById(adminId);
	}
}
